package top.codedance.iotp.loadblance.calgorithm;

import top.codedance.iotp.common.entity.NetworkEntity;
import top.codedance.iotp.common.entity.RegistServerMeta;

import java.util.List;

public class CCycle extends CAdapter {
    private static volatile int i = 0;
    @Override
    public NetworkEntity execute(List<RegistServerMeta> rsms) {
        if(i >= rsms.size()){
            i = 0;
        }
        RegistServerMeta rsm = rsms.get(i);
        NetworkEntity ne = new NetworkEntity(rsm.getBindIp(), rsm.getTcpPort());
        i++;
        return ne;
    }
}
